import java.io.PrintStream;
import java.util.Scanner;

/**
 * This program solve the How Many Points in Intersection UVA Problem 10790
 * @author Jonas Jeske www.inf.ufrgs.br/~jjeske
 * Status: Accepted
 *
 */
/*
 * input:#
 * 2 2
2 3
3 3
0 0
 */
public class Main {
	
	public static void main(String[] args){
		Main howManyPoints = new Main();
		howManyPoints.begin();		
	}	
	private long aa;
	private long bb;
	private long soma;
	private long cases = 1;	

	private void begin() {
		Scanner entrada = new Scanner(System.in);
		PrintStream saida = new PrintStream(System.out);
		aa = entrada.nextLong();
		bb = entrada.nextLong();
		
		while( (aa != 0) && (bb != 0)){
			
			soma = aa + bb;
			aa = Math.min(aa, bb);
			bb = soma - aa;
			saida.printf("Case %d: %d\n",cases,resolver(aa,bb));
			
			cases++;
			aa = entrada.nextLong();
			bb = entrada.nextLong();
		}	
	}

	/*resolve o problema*/
	private static long resolver(long a, long b) {
		long f,l,total;	
		if(a <= 1) {
			return 0;
		}
		f = (b * (b-1))/2;
		total = a-1;
		l = f*total;
		return ((f+l)*total)/2;
	}

}